package com.ledong.se.string;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

public class TestString {
    public static List<String> topic = new ArrayList<String>();

    public static void main(String[] args) {
        testValueOf();
    }

    public static void testPuserStr() {
        String a = "#第一个话题    #";
        // String a = "#fea";
        int count = StringUtils.countMatches(a, "#");
        if (count < 2) {
            return;
        }
        processStr(a);
        for (String str : topic) {
            System.out.println(str);
        }

    }

    public static String processStr(String str) {
        int locat = str.indexOf("#");
        str = str.substring(locat + 1);
        locat = str.indexOf("#");
        String new_str = str.substring(0, locat);
        str = str.substring(new_str.length() + 1);
        topic.add(new_str);
        if (StringUtils.countMatches(str, "#") > 1) {
            str = processStr(str);
        }
        return str;
    }

    public static void testValueOf() {
        String a = null;
        String b = String.valueOf(a);
        System.out.println(a);
        System.out.println(b);
        System.out.println(b.getClass());
    }
}
